package com.contest.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.contest.dao.RaceInfoDao;
import com.contest.entity.BettingRecord;
import com.contest.entity.RaceInfo;
import com.contest.entity.UserInfo;
import com.contest.service.BettingRecordService;
import com.contest.service.RaceInfoService;
import com.contest.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * ${table.comment}  服务实现类
 * </p>
 *
 * @author yfl
 * @since ${date}
 */
@Service
public class RaceInfoServiceImpl extends ServiceImpl<RaceInfoDao, RaceInfo> implements RaceInfoService {
    @Autowired
    RaceInfoDao raceInfoDao;
    @Autowired
    UserInfoService userInfoService;
    @Autowired
    BettingRecordService bettingRecordService;

    @Override
    public Page<RaceInfo> selectListByPage(Page<RaceInfo> mPage) {
        Map<String, Object> param = mPage.getCondition();
        int rows = mPage.getSize();
        int start = (mPage.getCurrent() - 1) * rows;
        List<RaceInfo> raceInfoList = raceInfoDao.selectByPage(param, start, rows);
        int total = raceInfoDao.selectByPageCount(start, rows);
        mPage.setRecords(raceInfoList);
        mPage.setTotal(total);
        return mPage;
    }
}
